#pragma once
#include <vector>
#include <stdio.h>
#include <iostream>
#include "ConsoleHelper.h"
using namespace std;

#define RENT_SIZE 6

class Player;

typedef enum Colors
{
	PURPLE = 1,
	LIGHT_BLUE,
	RED,
	DARK_GREEN,
	DARK_RED,
	YELLOW,
	GREEN,
	DARK_BLUE,
	TRAIN,
	UTILITY,
	NUM_COLORS
};

class Property
{
private:
	int m_rent[6]; // 4 houses, 1 hotel, 1 unimproved
	int m_houses;
	int m_mortgageValue;
	int m_pricePerHouse;
	Player* m_owner;
	bool m_mortgaged;
	char* m_name;
	char m_color;
public:
	Property(char* a_name, int a_rent[RENT_SIZE], int a_mortgageValue, int a_pricePerHouse, char a_color);
	
	void Draw(int a_x, int a_y);

	char* getName();
	
	int getRent(int a_roll);

	// Get the number of houses on a property
	// Returns -1 on non-housable properties
	int getHouses();

	int getOwner();

	void setOwner(Player* a_owner);

	int getColor() { return m_color; }

	int getPricePerHouse() { return m_pricePerHouse; }

	bool addHouse() 
	{ 
		m_houses++; 

		// Can't have THAT many houses, geez!
		if(m_houses > 5)
		{
			m_houses--;
			return false;
		}
		return true;
	}

	bool removeHouse()
	{
		m_houses--;

		if(m_houses < 0)
		{
			m_houses++;
			return false;
		}

		return true;
	}

	bool isMortgaged() { return m_mortgaged; }

	void toggleMortgaged() { m_mortgaged = !m_mortgaged; }

	int getMortgageValue() { return m_mortgageValue; }  
};